<template>
  <h3>用户管理</h3>
  <div>
    <a-form
      style="max-width: 480px; margin: 0 auto"
      label-align="left"
      auto-label-width
      :model="form"
      @submit="handleFind"
    >
      <a-form-item field="userAccount" label="账号">
        <a-input v-model="form.userAccount" placeholder="请输入账号" />
      </a-form-item>
      <a-form-item>
        <a-button
          type="primary"
          html-type="submit"
          style="margin-left: 117px; width: 120px"
        >
          查找
        </a-button>
      </a-form-item>
    </a-form>
  </div>
  <div>
    <table style="margin: auto">
      <tr>
        <td>用户名</td>
        <td>密码</td>
        <td>修改设置</td>
      </tr>
      <tr>
        <td id="test1"></td>
        <td id="test2"></td>
        <td><button>修改</button>|<button>删除</button></td>
      </tr>
    </table>
  </div>
</template>
<script setup lang="ts">
import GLOBAL from "@/store/find";
import { reactive } from "vue";
import { UserControllerService, UserLoginRequest } from "../../../generated";
import message from "@arco-design/web-vue/es/message";
import { useRouter } from "vue-router";
import { useStore } from "vuex";
const form = reactive({
  userAccount: "",
});
let acc = "";
let pass = "";
const handleFind = async () => {
  const res = await UserControllerService.userFindUsingPost(form.userAccount);
  if (res.code === "nothispeople") {
    message.error("查无此人");
  } else {
    acc = res + "aa";
    pass = res;
    alert(res);
    change();
  }
};
function change() {
  var x = document.getElementById("test1");
  x!.innerHTML = acc;
  var y = document.getElementById("test2");
  y!.innerHTML = pass;
}
</script>
